var ReportPage = {
	'add': function() {
		MsgBox.open("reportAdd", "新增报表信息", ctx + "/report/add/index", "1000px");
	},
	'addParams': function() {
		var reportId = $("#reportParamsFrm").find("input[name='reportId']").val();
		MsgBox.open("reportParamsAdd", "新增报表参数", ctx + "/report/params/add/" + reportId + "/index", "600px");
	},
	'delete': function(item, e, rowNumber) {
		MsgBox.confirm("确认删除报表【" + item.reportName + "】吗，这可能导致与之关联的报表不可用？", null, function() {
            var reportId = item.reportId;
            deleteByIdAjax.tempUrl(function(url) {
            	return url + reportId;
            }).send();
        });
	},
	'update': function(item, e, rowNumber) {
		var reportId = item.reportId;
		// 打开对话框
		MsgBox.open("reportUpdate", "更新报表信息", ctx + "/report/update/" + reportId + "/index", "1000px");
	},
	'updateParams': function(item, e, rowNumber) {
		MsgBox.open("reportParamsUpdate", "更新报表参数", ctx + "/report/params/update/" + item.reportId + "/" + item.paramKey + "/index", "600px");
	},
	'deleteParams': function(item, e, rowNumber) {
		MsgBox.confirm("确认删除报表参数【" + item.paramName + "】吗？", null, function() {
			deleteParamsByIdAjax.tempUrl(function(url) {
            	return url + item.reportId + '/' + item.paramKey + '/one';
            }).send();
        });
	},
	'onDeleteSucc': function(data, status, xhr) {
		$.messager.info(data.message);
		datatable.refresh(false);
	},
	'findByCondition': function() {
		datatable.refresh();
	},
	'findParamsByCondition': function() {
		paramsDatatable.refresh();
	},
	'onItemClick': function(index, item) {
		var reportId = item.reportId;
		$("#reportParamsFrm").find("input[name='reportId']").val(reportId);
		paramsDatatable.refresh();
	},
	'onDeleteParamsSucc': function(data, status, xhr) {
		$.messager.info(data.message);
		paramsDatatable.refresh(false);
	}
};
$(function(){
	parent.IndexPage.toggleLocker('close'); // 沉浸式体验
});